/*
 * 产品列表搜索
 * @Author: ljb 
 * @Date: 2017-11-27 15:24:29 
 * @Last Modified by: ljb
 * @Last Modified time: 2018-02-01 18:00:52
 */
<template>
<Form ref="formInline" inline>

    <Form-item label="产品分类" porp="product_category_id" :label-width="100">
        <Select v-model="formValidate.product_category_id" clearable  filterable>
            <OptionGroup v-for="category in categories" :key="category.id" :label="category.name">
                <Option v-for="sub_category in category.get_sub_categories" :value="sub_category.id + ''" :key="sub_category.id">{{ sub_category.name }}</Option>
            </OptionGroup>
        </Select>
    </Form-item>

    <Form-item label="产品型号" prop="model_number" :label-width="100">
         <Input v-model="formValidate.model_number" type="text" placeholder="请输入产品型号"></Input>
    </Form-item> 

    <Form-item label="产品标题" prop="title" :label-width="100">
         <Input v-model="formValidate.title" type="text" placeholder="请输入产品标题"></Input>
    </Form-item> 

    <Form-item>
        <Button type="primary" @click="confirmSearch">搜索</Button>
    </Form-item>
    
</Form>
</template>
<script>

export default {

    name: 'product-search-form',

    props: ['categories'],

    data: function () {
        return {

            // real_date : '',             //格式化的时间

            formValidate : {
                 
                product_category_id: '',

                model_number : '',

                title: ''

            },                  //搜索框的对象参数
        }
    },

    mounted() {

    },

    methods: {

        /**
         * 确认搜索
         * @return {undefined}
         */
        confirmSearch(){

            const param = {

                product_category_id : this.formValidate.product_category_id,

                model_number: this.formValidate.model_number,

                title: this.formValidate.title

            }

            this.$emit('search',param);

        }
        
    },
    
}

</script>